import { createRouter, createWebHashHistory } from "vue-router";

// 1、定义路由组件
import Guide from "@/views/Guide/Guide.vue";
import { ErrorRoutes } from "../views/ErrorPage/route";
import { LoginRoutes } from "../views/Logins/route";
import { MainRoutes } from "../views/Main/route";

// 2、定义路由配置选项
const routes: any = [
  {
    path: "/",
    redirect: "/login",
  },
  {
    path: "/guide",
    name: "guide",
    component: Guide,
  },
  ...ErrorRoutes,
  ...LoginRoutes,
  ...MainRoutes,
  {
    path: "/:pathMatch(.*)", //这里全局匹配和vue2不一样
    redirect: { name: "notfound" },
  },
];

export const router: any = createRouter({
  routes,
  history: createWebHashHistory(),
});
